package com.zzptc.zzsgz.bdsjws.Adapter;


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.vo.AddTel;


import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class AddAdapter extends RecyclerView.Adapter<AddAdapter.ViewHolder>{

    private List<AddTel> list;
    public AddAdapter(List<AddTel> list){
        this.list = list;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.add_item , parent , false);
        AddAdapter.ViewHolder viewHolder = new AddAdapter.ViewHolder(itemView);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        AddTel itemData = list.get(position);
        holder.tv_add_name.setText(itemData.getTelephone());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }


    public static class ViewHolder extends RecyclerView.ViewHolder{
        @BindView(R.id.tv_add_item)
        TextView tv_add_name;
        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }

}
